#include "subject.h"
#include "observer.h"
#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main()
{
	cout << "=====================client=====================" << endl;

	Subject* sub1 = new ConcreteSubjectA();
	Subject* sub2 = new ConcreteSubjectB();

	Observer* ob1 = new ConcreteObserverA("张三");
	Observer* ob2 = new ConcreteObserverB("李四");
	Observer* ob3 = new ConcreteObserverA("王二");


	sub1->Attach(ob1);
	sub1->Attach(ob2);

	sub2->Attach(ob2);
	sub2->Attach(ob3);

	sub1->DoSomething();
	sub1->Notify();

	sub2->DoSomething();
	sub2->Notify();


	delete ob1;
	delete ob2;
	delete ob3;
	delete sub1;
	delete sub2;

	return 0;
}